package com.zjitc.chapter07.domain;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

@Component
@Data
public class Student {
    @Value("1")
    private Integer id;
    @Value("张三")
    private String name;
    @PostConstruct
    public void init() {
        System.out.println("初始化Student后，调用init()");
    }
    @PreDestroy
    public void destroy() {
        System.out.println("销毁Student前，调用destroy()");
    }
}
